// @ts-ignore
/* eslint-disable */
import request from '@/request/request.ts'

/** 创建应用 POST /app/add */
export async function addApp(body: API.AppAddRequest,
  options ?: {[key: string]: any}
) {
  return request<API.BaseResponseLong>('/app/add', {
  method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 管理员分页获取应用列表 POST /app/admin/list/page/vo */
export async function listAppVoByPageByAdmin(body: API.AppQueryRequest,
  options ?: {[key: string]: any}
) {
  return request<API.BaseResponsePageAppVO>('/app/admin/list/page/vo', {
  method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 管理员更新应用 POST /app/admin/update */
export async function updateAppByAdmin(body: API.AppAdminUpdateRequest,
  options ?: {[key: string]: any}
) {
  return request<API.BaseResponseBoolean>('/app/admin/update', {
  method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 删除应用 POST /app/delete */
export async function deleteApp(body: API.DeleteRequest,
  options ?: {[key: string]: any}
) {
  return request<API.BaseResponseBoolean>('/app/delete', {
  method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 部署应用 POST /app/deploy */
export async function deployApp(body: API.AppDeployRequest,
  options ?: {[key: string]: any}
) {
  return request<API.BaseResponseString>('/app/deploy', {
  method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 下载应用代码 GET /app/download/${param0} */
export async function downloadAppCode(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.downloadAppCodeParams
    ,
  options ?: {[key: string]: any}
) {
  const { 'appId': param0,
  ...queryParams
  } = params;
  return request<any>(`/app/download/${param0}`, {
  method: 'GET',
    params: {...queryParams,},
    ...(options || {}),
  });
}

/** 生成应用 POST /app/gen */
export async function chatGenCode(body: API.AppGenRequest,
  options ?: {[key: string]: any}
) {
  return request<API.ServerSentEventString[]>('/app/gen', {
  method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 根据 id 获取应用详情 GET /app/get/vo */
export async function getAppVoById(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.getAppVOByIdParams
    ,
  options ?: {[key: string]: any}
) {
  return request<API.BaseResponseAppVO>('/app/get/vo', {
  method: 'GET',
    params: {
        ...params,},
    ...(options || {}),
  });
}

/** 分页获取精选应用列表 POST /app/good/list/page/vo */
export async function listGoodAppVoByPage(body: API.AppQueryRequest,
  options ?: {[key: string]: any}
) {
  return request<API.BaseResponsePageAppVO>('/app/good/list/page/vo', {
  method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 分页获取当前用户创建的应用列表 POST /app/my/list/page/vo */
export async function listMyAppVoByPage(body: API.AppQueryRequest,
  options ?: {[key: string]: any}
) {
  return request<API.BaseResponsePageAppVO>('/app/my/list/page/vo', {
  method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 更新应用 POST /app/update */
export async function updateApp(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.updateAppParams
    ,body: API.AppUpdateRequest,
  options ?: {[key: string]: any}
) {
  return request<API.BaseResponseBoolean>('/app/update', {
  method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    params: {
        ...params,},
    data: body,
    ...(options || {}),
  });
}

